Skip to content

Scala: Ensure implicit conversion keeps type fidelity #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 13, 2021

Conversation

rozza
Copy link
Member

@rozza rozza commented Jan 11, 2021

When converting from a BsonDocument to org.bson.Document
the scala driver previously used json. The implementation
should not rely on the json output format, but rather use
the Codecs to do the conversion.

JAVA-3916

When converting from a BsonDocument to org.bson.Document
the scala driver previously used json. The implementation
should not rely on the json output format, but rather use
the Codecs to do the conversion.

JAVA-3916
@rozza rozza requested review from jyemin and stIncMale January 11, 2021 16:22
@jyemin jyemin requested review from stIncMale and jyemin and removed request for jyemin January 11, 2021 16:59
val bsonDocument = Document(
"null" -> BsonNull(),
"int32" -> BsonInt32(32),
"int64" -> BsonInt64(64L),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd change 64L -> Long.MaxValue for reproducing issue in JIRA ticket.

FYI, I am OP of the bug

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

"null" -> BsonNull(),
"int32" -> BsonInt32(32),
"int64" -> BsonInt64(Long.MaxValue),
"decimal128" -> BsonDecimal128(128),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I would explicitly pass 128.1 as with BsonDouble.

@rozza rozza merged commit 36d0e7f into mongodb:master Jan 13, 2021
@rozza rozza deleted the j3916 branch January 13, 2021 14:54
jfitzu pushed a commit to nextworld-tools/mongo-java-driver that referenced this pull request Mar 3, 2021
When converting from a BsonDocument to org.bson.Document
the scala driver previously used json. The implementation
should not rely on the json output format, but rather use
the Codecs to do the conversion.

JAVA-3916
jfitzu added a commit to nextworld-tools/mongo-java-driver that referenced this pull request Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants